<template>
    <div class="box">
        <div class="top">
            <p class="title">实时游客统计</p>
            <p class="bg"></p>
            <p class="right">可预约总量<span>9999</span>人</p>
        </div>
        <div class="number">
            <span v-for="(item, index) in people" :key="index">{{ item }}</span>
        </div>
        <div class="charts" ref="chart"></div>
    </div>
</template>

<script setup lang='ts'>
import { ref, onMounted } from 'vue'
import * as echarts from 'echarts'
import 'echarts-liquidfill'

const chart = ref()
const people = ref('237903人')

onMounted(() => {
    const mycharts = echarts.init(chart.value)
    mycharts.setOption({
        series: [{
            name: '预约量',
            type: 'liquidFill',
            label: {
                formatter: '{a}',
                fontSize: 20
            },
            data: [0.3, 0.5, 0.4, 0.3],
            animationDuration: 1500,
            animationDurationUpdate: 1000,
            animationEasingUpdate: 'cubicOut',
            radius: '90%',
            color: ['#1cb8bf', '#156ACF', '#1598ED', '#1cb8bf'],
            waveLength: '80%',
            phase: 'auto',
            period: 'auto',
            outline: {
                show: true,
                borderDistance: 8,
                itemStyle: {
                    color: 'none',
                    borderColor: '#2eb4cd',
                    borderWidth: 8,
                    shadowBlur: 20,
                    shadowColor: 'rgba(0, 0, 0, 0.8)'
                }
            },
            amplitude: '10%',
            backgroundStyle: {
                color: '#0e2245'
            }
        }]
    });
})
</script>

<style scoped lang="scss">
.box {
    background: url(@/assets/screen/dataScreen-main-lb.png) no-repeat;
    background-size: cover;
    margin-top: 20px;

    .top {
        margin-left: 20px;

        .title {
            color: white;
            font-size: 20px;
        }

        .bg {
            width: 68px;
            height: 7px;
            background: url(@/assets/screen/dataScreen-title.png) no-repeat;
            background-size: cover;
            margin-top: 10px
        }

        .right {
            float: right;
            color: white;
            font-size: 20px;

            span {
                color: orange;
            }
        }
    }

    .number {
        margin-top: 30px;
        display: flex;
        padding: 20px;

        span {
            flex: 1;
            height: 45px;
            text-align: center;
            line-height: 45px;
            background: url(@/assets/screen/total.png) no-repeat;
            background-size: cover;
            color: #29fcff;
            font-weight: 900;
            font-size: 30px
        }
    }

    .charts {
        width: 100%;
        height: 260px;
    }
}
</style>